<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/11/20
 * Time: 11:10
 */
namespace merchants;
class Configs
{
    public static function Config(){
        //// 获取公私钥匙
//$priKey = loadPk12Cert(PRI_KEY_PATH, CERT_PWD);
////$priKey_2 = loadPk12Cert(PRI_KEY_PATH_2, CERT_PWD);
//$pubKey = loadX509Cert(PUB_KEY_PATH);
        $with=new WithdrawBank();
        $pub_path='../extend/merchants/cert/sand.cer';
        $pri_path='../extend/merchants/cert/yfrmm.pfx';
        $pwd='yfr123';
        return $config=[
            'api_host'=>'https://caspay.sandpay.com.cn/agent-main/openapi',
            'pub_key_path'=>$pub_path, //公钥文件
            'pri_key_path'=>$pri_path, //私钥文件
            'cert_pwd'=>$pwd, //私钥证书密码
            'pubKey'=>$with->loadX509Cert($pub_path),
            'priKey'=>$with->loadPk12Cert($pri_path,$pwd),
            'merId'=>'10096905'//商户号
        ];
    }
    public static function getConfig(){
        $config=self::Config();
        return array(
            'agentpay' => array(
                'transCode' => 'RTPM', // 实时代付
                'merId' => $config, // 此处更换商户号
                'url' => '/agentpay',
                'pt' => array(
                    'orderCode' => date('YmdHis', time()),//订单编号
                    'version' => '01',//版本
                    'productId' => '00000004',//产品id
                    'tranTime' => date('YmdHis', time()),//交易时间
                    'timeOut' => '',//超时时间(不填默认24小时)
                    'tranAmt' => '000000000010',//金额
                    'currencyCode' => '156',//币种
                    'accAttr' => '0',//0-对私（产品ID为00000004 时）1-对公（产品ID为0000003 时）
                    'accNo' => '6217002590007132535',//收款人账户号（银行卡）
                    'accType' => '4',//账号类型3-公司账户 （产品 ID 为0000003时）4-银行卡（产品 ID 为0000004时）
                    'accName' => '江明楷ming',
//                    'provNo' => 'sh',
//                    'cityNo' => 'sh',
                    'bankName' => 'cbc',
//                    'bankType' => '1',
                    'remark' => 'pay',
                    'payMode' => '2',
                    'channelType' => '07'
                )
            ),
            'collection' => array(
                'transCode' => 'RTCO', // 实时代收
                'merId' => '100211701160001', // 此处更换商户号
                'url' => '/collection',
                'pt' => array(
                    'orderCode' => '500000100018',
                    'version' => '01',
                    'productId' => '00000002',
                    'tranTime' => date('YmdHis', time()),
                    'timeOut' => '20161024120000',
                    'tranAmt' => '000000000500',
                    'currencyCode' => '156',
                    'accAttr' => '0',
                    'accType' => '4',
                    'accNo' => '6226220209634996',
                    'accName' => '全渠道',
                    'bankName' => '全渠道',
                    'provNo' => '010000',
                    'cityNo' => '010000',
                    'certType' => '0001',
                    'certNo' => '321281198702253717',
                    'cardId' => '321281198702253717',
                    'phone' => '12345678901',
                    'bankInsCode' => '48270000',
                    'purpose' => 'collection',
                    'channelType' => '07'
                )
            ),
            'queryOrder' => array(
                'transCode' => 'ODQU', // 订单查询
                'merId' => '100211701160001', // 此处更换商户号
                'url' => '/queryOrder',
                'pt' => array(
                    'orderCode' => '500000100018',
                    'version' => '01',
                    'productId' => '00000003',
                    'tranTime' => '20181024120000'
                )
            ),
            'queryBalance' => array(
                'transCode' => 'MBQU', // 商户余额查询
                'merId' => '100211701160001', // 此处更换商户号
                'url' => '/queryBalance',
                'pt' => array(
                    'orderCode' => '200000001048',
                    'version' => '01',
                    'productId' => '00000003',
                    'tranTime' => date('YmdHis', time())
                )
            ),
            'queryAgentpayFee' => array(
                'transCode' => 'PTFQ', // 代付手续费查询
                'merId' => '100211701160001', // 此处更换商户号
                'url' => '/queryAgentpayFee',
                'pt' => array(
                    'orderCode' => '100000011171',
                    'version' => '01',
                    'productId' => '00000003',
                    'tranTime' => date('YmdHis', time()),
                    'tranAmt' => '000000020000',
                    'currencyCode' => '156',
                    'accAttr' => '1',
                    'accType' => '4',
                    'accNo' => '5187180008861234'
                )
            ),
            'realNameVerify' => array(
                'transCode' => 'RNAU', // 实名认证
                'merId' => '100211701160001', // 此处更换商户号
                'url' => '/realNameVerify',
                'pt' => array(
                    'orderCode' => '3000010010131',
                    'version' => '01',
                    'productId' => '00000003',
                    'tranTime' => date('YmdHis', time()),
                    'accAttr' => '0',
                    'accType' => '4',
                    'accNo' => '6216261000000000018',
                    'accName' => '汪中',
                    'certType' => '0101',
                    'certNo' => '350821198706134513',
                    'phone' => '15970847045'
                )
            ),
            'idCardVerify' => array(
                'transCode' => 'RNPA', // 实名公安认证
                'merId' => '100211701160001', // 此处更换商户号
                'url' => '/idCardVerify',
                'pt' => array(
                    'orderCode' => '400000000011',
                    'version' => '01',
                    'productId' => '00000003',
                    'tranTime' => date('YmdHis', time()),
                    'name' => '罗福',
                    'certType' => '0001',
                    'certNo' => '350424198806210053',
                    'returnPic' => '1',
                )
            ),
            'getClearFileContent' => array(
                'transCode' => 'CFCT', // 对账单申请
                'merId' => '100211701160001', // 此处更换商户号
                'url' => '/getClearFileContent',
                'pt' => array(
                    'version' => '01',
                    'clearDate' => '20170530',
                    'busiType' => '1',
                    'fileType' => '1'
                )
            ),
        );
    }
}
